<?php

namespace app\models;

use Yii;

/**
 * This is the model class for table "{{%ad}}".
 *
 * @property integer $id
 * @property string $title
 * @property string $url
 * @property integer $starttime
 * @property integer $endtime
 * @property integer $position_id
 * @property integer $sort
 * @property integer $status
 * @property integer $pic
 * @property string $remark
 */
class Ad extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return '{{%ad}}';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['title', 'position_id', 'pic'], 'required'],
            [['position_id', 'sort', 'pic', 'status'], 'integer'],
            [['title'], 'string', 'max' => 60],
            [['url'], 'string', 'max' => 200],
            [['remark'], 'string', 'max' => 120],
            [['starttime', 'endtime',], 'safe'],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'title' => '广告标题',
            'url' => '链接',
            'starttime' => '开始时间',
            'endtime' => '结束时间',
            'position_id' => '广告位',
            'sort' => '排序',
            'status' => '状态',
            'pic' => '广告图片',
            'remark' => '其他信息',
        ];
    }
}
